package chain_of_responsibility_pattern.exercise.exercise1;


import java.util.Scanner;

/**
 * 客户端主类
 * @author ricejson
 */
public class Main {
    public static void main(String[] args) {
        // 创建广告过滤器
        Filter adFilter = new AdvertisementFilter();
        // 创建政治敏感过滤器
        Filter politicsFilter = new PoliticsFilter();
        // 创建暴力过滤器
        Filter violenceFilter = new ViolenceFilter();
        // 设置责任链顺序
        adFilter.setSuccessor(politicsFilter);
        politicsFilter.setSuccessor(violenceFilter);
        // 输入
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String line = sc.nextLine();
            System.out.println(adFilter.filter(line));
        }
    }
}
